<!DOCTYPE html>
<html>
<head>
    <title>修改产权人信息页面</title>
<#include "../common/common.ftl"/>
    <link rel="stylesheet" href="/style/contractForm.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <form class="layui-form" id="setSpForm">
        <input type="hidden" name="contractId" value="${(contract.id)!}"/>
        <div class="layui-card">
            <div class="layui-card-header">修改产权人信息页面</div>
            <div class="layui-card-body">
                <table class="layui-table" id="overAreaTable">
                    <tr class="layui-bg-gray">
                        <th style="text-align: center;width: 3%">序号</span></th>
                        <th style="text-align: center;width: 10%">姓名</span></th>
                        <th style="text-align: center;width: 15%">身份证号</th>
                        <th style="text-align: center;width: 15%">联系电话</th>
                        <th style="text-align: center;width: 10%">关系</th>
                        <th style="text-align: center;width: 10%">取得类型</th>
                        <th style="text-align: center;width: 20%">备注</th>
                    </tr>
                <#if (buyHousePersonList??)>
                    <#list buyHousePersonList as buyHousePerson>
                        <tr>
                            <input type="hidden" name="buyHousePersonId" value="${(buyHousePerson.id)!}"/>
                            <td style="text-align: center;">${buyHousePerson_index+1}</td>
                            <td style="text-align: center;">${(buyHousePerson.name)!}</td>
                            <td style="text-align: center;">${(buyHousePerson.idCard)!}</td>
                            <td style="text-align: center;"><input type="text" name="tel" class="layui-input"
                                                                   value="${(buyHousePerson.tel)!}"/></td>
                            <td style="text-align: center;"><input type="text" name="relation" class="layui-input"
                                                                   value="${(buyHousePerson.relation)!}"/></td>
                            <td style="text-align: center;"><input type="text" name="type" class="layui-input"
                                                                   value="${(buyHousePerson.type)!}"/></td>
                            <td style="text-align: center;"><input type="text" name="memo" class="layui-input"
                                                                   value="${(buyHousePerson.memo)!}"/></td>
                        </tr>
                    </#list>
                </#if>
                </table>
            </div>
        </div>

        <button style="display: none;" class="layui-btn" id="submitBtn" name="submitBtn" lay-submit=""
                lay-filter="submit">立即提交
        </button>
    </form>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['form', 'dataDict'], function () {
        var form = layui.form, $ = layui.jquery, dataDict = layui.dataDict, parentIndex = parent.layer.getFrameIndex(window.name);

        //监听提交
        form.on('submit(submit)', function (data) {
            $.ajax({
                url: 'setBuyHousePersonTypeSave',
                type: 'post',
                data: $("#setSpForm").serialize(),//当前容器的全部表单字段，名值对形式：{name: value}
                async: false,
                success: function (data) {
                    if (data.code == "0001") {
                        parent.layer.close(parentIndex);
                    } else {
                        layer.msg(data.message, {anim: 6, icon: 2, time: 3000});
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>